x86/DMI: fix table mapping when one lives above 1Mb
authorJan Beulich <jbeulich@suse.com>
Tue, 24 Nov 2020 10:26:34 +0000 (11:26 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Sat, 27 Nov 2021 14:14:37 +0000 (15:14 +0100)
commita689e309b8893dae214a6a0d17d23b6746ba1e59
treeb0c87be531ade944d535dafb7a43c847824e0466
parent57077c0773d1dcf6b4683f10595a186b549e5343
x86/DMI: fix table mapping when one lives above 1Mb

Use of __acpi_map_table() is kind of an abuse here, and doesn't work
anymore for the majority of cases if any of the tables lives outside the
low first Mb. Keep this (ab)use only prior to reaching SYS_STATE_boot,
primarily to avoid needing to audit whether any of the calls here can
happen this early in the first place; quite likely this isn't necessary
at all - at least dmi_scan_machine() gets called late enough.

For the "normal" case, call __vmap() directly, despite effectively
duplicating acpi_os_map_memory(). There's one difference though: We
shouldn't need to establish UC- mappings, WP or r/o WB mappings ought to
be fine, as the tables are going to live in either RAM or ROM. Short of
having PAGE_HYPERVISOR_WP and wanting to map the tables r/o anyway, use
the latter of the two options. The r/o mapping implies some
constification of code elsewhere in the file. For code touched anyway
also switch to void (where possible) or uint8_t.

Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
(cherry picked from commit f390941a92f102ebbbbce1b54be206a602187fd7)
xen/arch/x86/dmi_scan.c